<template>
  <div class="hm-header">
    <!-- 头部部分 -->
    <header class="header">
      <h1>todos</h1>
      <input
        class="new-todo"
        placeholder="请输入任务名称"
        @keyup.enter="add"
        autofocus
        v-model.trim="name"
      />
    </header>
  </div>
</template>

<script>
export default {
  name: "HmHeader",
  data() {
    return {
      name: "",
    };
  },
  methods: {
    add() {
      // console.log(this.name);
      this.$emit("add", this.name);
      this.name = "";
    },
  },
};
</script>

<style></style>
